<?php defined('SYSPATH') OR die('No direct access allowed.');

class Phone_Plugin extends WB_FormItem {
	
	protected $db_type;			// valid: int, text
	
	public function __construct($name='', $params=array())
	{
		parent::__construct($name, $params, 'text phone');
	}
	
	// TODO: validation
	public function prep_db()
	{
		return 
			valid::phone($this->value) ? 
				(
					$this->db_type=='int' ?
						(int)$this->value :
						$this->value
				) :
				null;
	}
}

//End of Phone_Plugin Library